class MyArray<T>{
    //public T[] obj = (T[])new Object[3];
    public Object[] obj = new Object[3];

    public T getPos(int pos){
        return (T)obj[pos];
    }
    public void setObj(int pos,T val){
        obj[pos] = val;
    }
}

class Alg<E extends Comparable>{
    public E findMax(E[] arrays){
        E max = arrays[0];
        for (int i = 1; i < arrays.length; i++) {
            if(max.compareTo(arrays[i]) < 0){
                max = arrays[i];
            }
        }
        return max;
    }
}

class A<E extends Number>{


}

class Alg1 {
    public<E extends Comparable<E>> E findMax1(E[] arrays){
        E max = arrays[0];
        for (int i = 1; i < arrays.length; i++) {
            if(max.compareTo(arrays[i]) < 0){
                max = arrays[i];
            }
        }
        return max;
    }
}

class Alg2 {
    public static <E extends Comparable<E>> E findMax1(E[] arrays){
        E max = arrays[0];
        for (int i = 1; i < arrays.length; i++) {
            if(max.compareTo(arrays[i]) < 0){
                max = arrays[i];
            }
        }
        return max;
    }
}
public class Text {
    public static void main(String[] args) {
        Integer[] arr = {1,2,5,7,24,62,555,36,77,42,31,59,92};
        Integer max = Alg2.findMax1(arr);
        System.out.println(max);
    }
    public static void main8(String[] args) {
        Alg1 alg1 = new Alg1();
        Integer[] arr = {1,2,5,7,24,62,555,36,77,42,31,59,92};
        Integer max = alg1.<Integer>findMax1(arr);
        System.out.println(max);
    }
    public static void main7(String[] args) {
        A<Number> a = new A<>();
        A<Integer> b =new A<>();
        A<Double> c = new A<>();

    }
    public static void main6(String[] args) {
        Alg<Integer> alg = new Alg<>();
        Integer[] arr = {1,2,5,7,24,62,555,36,77,42,31,59,92};
        Integer max = alg.findMax(arr);
        System.out.println(max);
    }
    public static void main5(String[] args) {
        MyArray<Integer> myArray = new MyArray<Integer>();
        myArray.setObj(0,100);
        myArray.setObj(1,121);
        myArray.setObj(2,141);
        int a = myArray.getPos(0);
        System.out.println(a);
        System.out.println("==========================");
        MyArray<String> myArray1 = new MyArray<>();
        myArray1.setObj(0,"haha");
        myArray1.setObj(1,"heihei");
        myArray1.setObj(2,"hehe");
        String b = myArray1.getPos(1);
        System.out.println(b);
    }

    public static void main4(String[] args) {
        MyArray myArray = new MyArray();
        myArray.setObj(0,100);
        myArray.setObj(1,"hello");
        myArray.setObj(2,10.5);
        int a = (int)myArray.getPos(0);
        String b = (String)myArray.getPos(1);
        Double c = (Double)myArray.getPos(2);
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
    }
    public static void main3(String[] args) {
        Integer a = 100;
        Integer b = 100;
        System.out.println(a == b);
        Integer c = 200;
        Integer d = 200;
        System.out.println(c == d);
    }
    public static void main2(String[] args) {
        Integer val = 100;
        int i = val;
        System.out.println(i);
        int j = val.intValue();
        System.out.println(j);
        double k = val.doubleValue();
        System.out.println(k);
        float l = val.floatValue();
        System.out.println(l);
    }
    public static void main1(String[] args) {
        int a = 10;
        Integer val = a;
        System.out.println(val);
    }
}
